######
### Information for replicating the analysis for "Reining in the Rascals: Challenger Parties' Path to Power"
### The Journal of Politics
###
### Frederik Hjorth, Jacob Nyrup & Martin Vinæs Larsen
######

All code to replicate the analysis is written in R. 14 files in total are used to replicate the analysis in the article: 5 r-scripts and 9 datafiles.

The scripts use the R package "pacman" to install and load relevant packages, which is handled by the function pacman::p_load(). To make sure the function runs, the replicator should have "pacman" installed.

The scripts use the R package "here" to automatically set the working directory to the replication folder. If "here" fails to locate the appropriate folder, simply set the working directory to the folder containing scripts and data using setwd().

When running the analysis it is important that 00-helperfunctions.R is loaded into R. This file contains a list of extra functions used throughout the analysis.

### List of r-scripts

00-helperfunctions.R
01-comparativeanalysis.R
02-mainanalysis.R
03-mechanismanalysis.R
04-appendix.R

### List of datasets

df_comparative.xlsx
df_main.rds
df_mainretroactive.rds
dkvaa13txtdf.rds
dkvaa17txtdf.rds
dkvaa2013.xlsx
dkvaa2017.xlsx
irtposbyparty.rds
municodelist.txt